﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using bdnt_pets_system.Tools;
using System.IO.IsolatedStorage;
using bdnt_pets_system.SystemServiceReference;
using bdnt_pets_system_Entity;

namespace bdnt_pets_system
{
    public partial class MainPage : UserControl
    {
        private IsolatedStorageSettings appSettings = null;

        public MainPage()
        {
            InitializeComponent();
            appSettings = IsolatedStorageSettings.ApplicationSettings;
            vFrc.Tag = this;
            vLogin.Tag = this;
            LoadPage();
        }

        public void LoadPage()
        {
            if (appSettings.Contains(SessionManager.USERINFO))
            {
                vLogin.Visibility = System.Windows.Visibility.Collapsed;
                vFrc.Visibility = System.Windows.Visibility.Visible;
                vFrc.QueryData(true);
            }
            else
            {
                vLogin.Visibility = System.Windows.Visibility.Visible;
                vFrc.Visibility = System.Windows.Visibility.Collapsed;
                vLogin.LoadData();
            }
        }
    }
}
